import { ProcessType } from '@/views/Selection/Step';
import { Process } from './types/process';
// import http from "@/utils/http";

// export async function process_get(categoryId) {
//   return await http.get(`/process?categoryId=${categoryId}`);
// }

// export async function process_create(cid, step_data, extra_data = null) {
//   return await http.put("/process", {
//     cid: cid,
//     data: JSON.stringify([{ process: "START", data: step_data, extra_data }]),
//     id: null,
//     jobStep: "START",
//     paramJson: null,
//   });
// }

// export async function process_update(cid, process_data) {
//   return await http.put("/process", {
//     cid: cid,
//     data: JSON.stringify(process_data),
//     id: null,
//     jobStep: "START",
//     paramJson: null,
//   });
// }

// export async function process_delete(cid) {
//   return await http.delete(`/process?categoryId=${cid}`);
// }

export const process_get = (categoryId: string | number) => {
  return get<Process[]>(Prefix.api + `/process?categoryId=${categoryId}`);
};

export const process_update = (data: {
  cid: number;
  data: string;
  id?: number;
  jobStep: ProcessType;
  paramJson?: string;
  excelUrl?: string;
  confirmed?: boolean;
}) => {
  return put(Prefix.api + '/process', data);
};
